// 2025/11/9
// 字母异位词分组

class Solution {
public:
    vector<vector<string>> groupAnagrams(vector<string>& strs) {
        unordered_map<string, vector<string>> mp;
        for(auto &str : strs)
        {
            string tmp = str;
            sort(tmp.begin(), tmp.end());
            mp[tmp].emplace_back(str);
        }
        vector<vector<string>> ans;
        for(auto &[str, vec] : mp)
        {
            ans.emplace_back(vec);
        }
        return ans;
    }
};